Imports System.Windows.Forms

Public Class frmSelect

    Private Sub lstItemsMulti_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstItems.DoubleClick
        btnOK.PerformClick()
    End Sub

    Public Sub New(ByVal AllowMultiSelect As Boolean)

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        'lstItems.Visible = Not AllowMultiSelect
        'lstItemsMulti.Visible = AllowMultiSelect
        lstItems.SelectionMode = IIf(AllowMultiSelect, SelectionMode.MultiExtended, SelectionMode.One)
        btnSelectAll.Visible = AllowMultiSelect
    End Sub

    Private Sub btnSelectAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSelectAll.Click
        For i As Integer = 0 To lstItems.Items.Count - 1
            lstItems.SetSelected(i, True)
        Next
    End Sub
End Class
